package com.itheima.hashset;

import java.util.Comparator;
import java.util.HashSet;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
       // TreeSet<Student> treeSet = new TreeSet<>();
//        TreeSet<Student> hashSet = new TreeSet<Student>(new Comparator<Student>() {
//            @Override
//            public int compare(Student o1, Student o2) {
//                if((o1.getName().compareTo(o2.getName())==0&&(o1.getAge().compareTo(o2.getAge()))==0)){
//                    return 0;
//                }
//                return 1;
//            }
//        });
        HashSet<Student> hashSet = new HashSet<>();

        Student s1=new Student("张三","男","20");
        Student s2=new Student("李四","女","21");
        Student s3=new Student("张三","女","20");
        hashSet.add(s1);
        hashSet.add(s2);
        hashSet.add(s3);

        for (Student student : hashSet) {
            System.out.println(student);
        }

    }
}
